Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rfq+priceoraclerpc: add counterparty field to QueryAssetRatesRequest #1161

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

ffranr
Copy link
Contributor

@ffranr ffranr commented Oct 28, 2024

This commit updates the price oracle RPC interface by adding a counterparty field to the QueryAssetRatesRequest message. This field allows the price oracle to adjust asset rates based on the Lightning Network topology.


Notes for Reviewers

This PR depends on #1160
Merge PR #1160 first.

This PR will be in draft until then but is ready for review.

This type relates an asset to BTC rate to its expiry time.
This commit includes the following changes:
* Rename the `BuyRequest.SuggestedAssetRate` field to `AssetRateHint`
  with the new `AssetRate` type.
* Update the `queryAskFromPriceOracle` function to accept the
  `AssetRate` type as an argument.
* Update the `PriceOracle.QueryAskPrice` function to accept the
  `AssetRate` type as an argument.

This change provides the price oracle with the asset rate hint's expiry
timestamp from the BuyRequest, instead of relying on the default expiry
lifetime.
Rename `SellRequest.SuggestedAssetRate` to `AssetRateHint` and
change its type to the new `AssetRate`.
This update adds an asset rate hint argument to the
`queryBidFromPriceOracle`  negotiator method and the `PriceOracle`
interface's `QueryBidPrice` method.
As a result of this change the price oracle's quote expiry value is
used in the request constructor.
As a result of this change the price oracle's quote expiry value is
used in the request constructor.
This commit does the following:
* Make use of AssetRate in the OracleResponse type.
* Modify functions queryBidFromPriceOracle and queryAskFromPriceOracle
  such that they return the new AssetRate types.

Added TODOs noting that New*AcceptFromRequest functions will be modified
similarly in future work.
This commit updates the price oracle RPC interface by adding a
counterparty field to the QueryAssetRatesRequest message. This field
allows the price oracle to adjust asset rates based on the Lightning
Network topology.
@ffranr ffranr self-assigned this Oct 28, 2024
@coveralls
Copy link

Pull Request Test Coverage Report for Build 11556152827

Details

  • 4 of 15 (26.67%) changed or added relevant lines in 2 files are covered.
  • 34 unchanged lines in 6 files lost coverage.
  • Overall coverage decreased (-0.05%) to 40.369%

Changes Missing Coverage Covered Lines Changed/Added Lines %
rfq/oracle.go 4 6 66.67%
rfq/negotiator.go 0 9 0.0%
Files with Coverage Reduction New Missed Lines %
commitment/tap.go 2 84.43%
asset/asset.go 4 81.61%
tapchannel/aux_leaf_signer.go 5 35.92%
tapdb/multiverse.go 7 60.32%
tapgarden/caretaker.go 7 68.21%
universe/interface.go 9 47.09%
Totals Coverage Status
Change from base Build 11555428828: -0.05%
Covered Lines: 24419
Relevant Lines: 60489

💛 - Coveralls

@ffranr ffranr requested review from gijswijs and removed request for GeorgeTsagk October 28, 2024 15:04
@dstadulis dstadulis added this to the v0.4.2 milestone Oct 28, 2024
@ffranr
Copy link
Contributor Author

ffranr commented Oct 28, 2024

For privacy reasons, providing the peer ID to the price oracle service should be disabled by default. We should expect that a third-party public price oracle service will be used by default.

@ffranr ffranr force-pushed the rfq-pass-rate-expiry-to-price-oracle branch 2 times, most recently from 029b0cb to 5c2ad43 Compare October 29, 2024 19:59
@ffranr ffranr force-pushed the rfq-pass-rate-expiry-to-price-oracle branch 2 times, most recently from 10a9192 to 71d2293 Compare October 30, 2024 17:35
Base automatically changed from rfq-pass-rate-expiry-to-price-oracle to main October 30, 2024 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 👀 In review
Development

Successfully merging this pull request may close these issues.

3 participants